Object.defineProperty(exports, "__esModule", {
    value: !0
}), exports.generateSignParams = generateSignParams, exports.generateHeaderParams = generateHeaderParams, 
exports.generateSignParamsStr = generateSignParamsStr, exports.default = void 0;

var _md5Min = _interopRequireDefault(require("../lib/md5.min.js")), _util = _interopRequireDefault(require("./util"));

function _interopRequireDefault(e) {
    return e && e.__esModule ? e : {
        default: e
    };
}

function _objectSpread(r) {
    for (var e = 1; e < arguments.length; e++) {
        var t = null != arguments[e] ? arguments[e] : {}, a = Object.keys(t);
        "function" == typeof Object.getOwnPropertySymbols && (a = a.concat(Object.getOwnPropertySymbols(t).filter(function(e) {
            return Object.getOwnPropertyDescriptor(t, e).enumerable;
        }))), a.forEach(function(e) {
            _defineProperty(r, e, t[e]);
        });
    }
    return r;
}

function _defineProperty(e, r, t) {
    return r in e ? Object.defineProperty(e, r, {
        value: t,
        enumerable: !0,
        configurable: !0,
        writable: !0
    }) : e[r] = t, e;
}

var authkey = "c3a39e4eeacf4542d6a488e19037fa45", platform = "web", method = "md5";

function generateSignParams() {
    var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
    e = Object.assign({}, e, {
        timestamp: Math.floor(Date.now() / 1e3),
        platform: platform
    });
    var r = _util.default.serialize(e);
    return _objectSpread({
        sign: (0, _md5Min.default)(r + authkey),
        method: method
    }, e);
}

function generateHeaderParams() {
    var e = Math.floor(Date.now() / 1e3);
    return {
        token: (0, _md5Min.default)(authkey + e),
        platform: platform,
        createtime: e
    };
}

function generateSignParamsStr(e) {
    return _util.default.serialize(generateSignParams(e));
}

var _default = {
    generateSignParams: generateSignParams,
    generateHeaderParams: generateHeaderParams,
    generateSignParamsStr: generateSignParamsStr
};

exports.default = _default;